﻿using iMES.Core.BaseProvider;
using iMES.Core.Extensions.AutofacManager;
using iMES.Entity.DomainModels;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using YUN.ProductionManage.IRepositories;
using YUN.ProductionManage.IServices;

namespace YUN.ProductionManage.Services
{
    public partial class Product_ProductOrderListService : ServiceBase<OrderProductList, IProduct_ProductOrderListRepository>
   , IProduct_ProductOrderListService, IDependency
    {
        public Product_ProductOrderListService(IProduct_ProductOrderListRepository repository)
        : base(repository)
        {
            Init(repository);
        }
        public static IProduct_ProductOrderListService Instance
        {
            get { return AutofacContainerModule.GetService<IProduct_ProductOrderListService>(); }
        }
        public async Task<List<OrderProductList>> GetOrderDetailsByIdAsync(Guid productionOrderId)
        {
            // 查询生产订单信息
            var order = await _repository.FindAsync(x => x.ProductionOrderId == productionOrderId);

            // 返回订单明细列表
            return order ?? new List<OrderProductList>();
        }
    }
}
